"""
__author__ = 'heyanmin'
__time__ = '2021/4/18 2:47 下午'
"""
# 通讯录页面
from selenium.webdriver.common.by import By

from web_po_wechat.page.base_page import BasePage


class ContactPage(BasePage):
    # 添加部门按钮 +
    __add_department_btn =  (By.CSS_SELECTOR,'.member_colLeft_top_addBtn')
    # 添加部门标签
    __add_department_create  = (By.CSS_SELECTOR,'.js_create_party')
    # # 添加子部门 js_add_sub_party
    # __add_department_sub = (By.CSS_SELECTOR, '.js_add_sub_party')
    # 列表 部门名称
    __department_name = (By.CSS_SELECTOR, '.jstree-anchor')

    def get_contactList(self):
        # 获取元素列表---通讯录第二列姓名
        ele_list = self.driver.find_elements(By.CSS_SELECTOR,".member_colRight_memberTable_td:nth-child(2)")
        print(ele_list)
        # 断言要断言名称
        # 遍历元素列表，通过元素的text属性，提取文本信息，进行断言（name_list就是要断言的内容）
        name_list = []
        for ele in ele_list:
           name_list.append(ele.text)
        # print(name_list)
        return name_list

    # 获取部门列表
    def get_departmentList(self):
        depart_list = self.find(self.__department_name)
        depart_list = []
        for ele in depart_list:
            depart_list.append(ele.text)
        return depart_list

